#include <bits/stdc++.h>
using namespace std;
int n,l,r,p,q,f,g;
int main () {
	freopen ("candy.in","r",stdin);
	freopen ("candy.out","w",stdout);
	scanf ("%d%d%d",&n,&l,&r);
	p = l / n,q = l % n;
	f = r / n,g = r % n;
	if (p == f) {
		printf ("%d",g);
	}
	else {
		printf ("%d",n - 1);
	}
	return 0;
}
